from pages.base_page import BasePage
'''
点击立即购买后的下单页面
'''
class CheckoutPage(BasePage):
    receiver_input = {'type': 'name', 'value': 'firstname'}
    phone_input = {'type': 'name', 'value': 'telephone'}
    address_input = {'type': 'name', 'value': 'address_1'}
    submit_btn = {'type': 'id', 'value': 'button-confirm'}
    result_msg = {'type': 'css', 'value': '.checkout-success'}
    def fill_order_info(self, receiver, phone, address):
        self.input_data(self.receiver_input['value'], receiver, by=self.receiver_input['type'])
        self.input_data(self.phone_input['value'], phone, by=self.phone_input['type'])
        self.input_data(self.address_input['value'], address, by=self.address_input['type'])

    def submit_order(self):
        self.click_element(self.submit_btn['value'], by=self.submit_btn['type'])
        return self.get_text(self.result_msg['value'], by=self.result_msg['type'])
